package com.adityayadav.mini.server;

import java.nio.charset.Charset;

public class WebSocketServerClientAccessPolicy {
	private static final String NEWLINE = "\r\n";

    public static byte[] getContent(String webSocketLocation) {
        return (
        		"<?xml version=\"1.0\" encoding=\"utf-8\" ?>"+ NEWLINE +
        		"<access-policy>"+ NEWLINE +
        			"<cross-domain-access>"+ NEWLINE +
        				"<policy>"+ NEWLINE +
        					"<allow-from http-request-headers=\"*\">"+ NEWLINE +
        						"<domain uri=\"*\"/>"+ NEWLINE +
        					"</allow-from>"+ NEWLINE +
        					"<grant-to>"+ NEWLINE +
        						"<resource include-subpaths=\"true\" path=\"/\"/>"+ NEWLINE +
        					"</grant-to>"+ NEWLINE +
        				"</policy>"+ NEWLINE +
        			"</cross-domain-access>"+ NEWLINE +
        		"</access-policy>" + NEWLINE).getBytes(Charset.forName("US-ASCII"));
    }
}
